public class PhoneBillCalculator {

    public static double calculateCost(int minutes) {
        if (minutes <= 20) {
            return minutes * 0.05;
        } else {
            return 1.00 + (minutes - 20) * 0.10;
        }
    }

    public static double calculateCost(int startHour, int startMinute, int endHour, int endMinute) {
        int startTotalMinutes = startHour * 60 + startMinute;
        int endTotalMinutes = endHour * 60 + endMinute;

        // 处理夏令时转换
        if (endTotalMinutes < startTotalMinutes) {
            endTotalMinutes += 24 * 60; // 跨越午夜
        }

        int duration = endTotalMinutes - startTotalMinutes;

        if (duration <= 20) {
            return duration * 0.05;
        } else {
            return 1.00 + (duration - 20) * 0.10;
        }
    }
}